package com.symaster.common.swing.element;

import com.symaster.common.swing.util.SwingUtil;

import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.util.ArrayList;

/**
 * @author yinmiao
 * @date 2022-02-26 15:00
 */
public class SyzdListPanel extends JComponent {
    private JPanel root_panel;
    private JPanel list_area;

    public SyzdListPanel() {
        setLayout(new BorderLayout());
        add(root_panel);
    }

    public static void main(String[] args) throws Exception {

        ArrayList<SyzdListPanel> syzdListPanels = new ArrayList<>();
        ArrayList<JFrame> jFrames = new ArrayList<>();

        SwingUtilities.invokeLater(() -> {
            syzdListPanels.add(new SyzdListPanel());
            jFrames.add(new JFrame());
            JFrame jFrame = jFrames.get(0);
            SyzdListPanel syzdListPanel = syzdListPanels.get(0);
            syzdListPanel.setPreferredSize(new Dimension(500, 900));
            jFrame.setContentPane(syzdListPanel);
            jFrame.pack();
            SwingUtil.toCenter(jFrame);
            jFrame.setVisible(true);
        });
    }

    {
        // GUI initializer generated by IntelliJ IDEA GUI Designer
        // >>> IMPORTANT!! <<<
        // DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        root_panel = new JPanel();
        root_panel.setLayout(new BorderLayout(0, 0));
        root_panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
        final JScrollPane scrollPane1 = new JScrollPane();
        root_panel.add(scrollPane1, BorderLayout.CENTER);
        scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
        list_area = new JPanel();
        list_area.setLayout(new CardLayout(0, 0));
        scrollPane1.setViewportView(list_area);
        list_area.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
    }

    /** @noinspection ALL */
    public JComponent $$$getRootComponent$$$() {
        return root_panel;
    }

}
